$(document).ready( function() {
	
	$("#search-results").scroll(function() {
		listHeight = $(this).innerHeight();
		wrapperHeight = this.scrollHeight;
		scrollTop = $(this).scrollTop();
		
		distanceFromBottom = wrapperHeight - listHeight - scrollTop;
		
		if (distanceFromBottom == 0 && $("#search-results").html()) {
			loadResults();
		}
	});
	
});